<?php
require 'PasswordHash.php';
function openFile($email)
{
    $myFile = $email.".txt";
    if(file_exists($myFile))
    {
        $fh = fopen($myFile, 'r');
        $theData = fread($fh, filesize($myFile));
        $pieces = explode(";", $theData);
        fclose($fh);
        return $pieces;
    }
    
}

function writeFile($email,$name,$pass)
{
    $myFile = $email.".txt";
    var_dump($email);
    $fh = fopen($myFile, 'w') or die("can't open file");
    $name = $name;
    $pass = ';'.$pass;
    $email = ';'.$email;
    fwrite($fh, $name);
    $hashpass = new PasswordHash(8,TRUE);
    $hash = $hashpass->HashPassword($pass);
    fwrite($fh,$hash);
    fwrite($fh,$email);
    fclose($fh);
}
?>
